package com.killer.controller;

import com.killer.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/email")
public class EmailController {

    @Autowired
    private EmailService emailService;

    @RequestMapping("/{email}/{code}")
    public Boolean sendCode(@PathVariable String email,@PathVariable String code){
        try {
            emailService.sendCode(email, code);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
